const { defineConfig } = require("@vue/cli-service");
const path = require("path");
function resolve(dir) {
  return path.join(__dirname, dir);
}
module.exports = defineConfig({
  transpileDependencies: true,
  chainWebpack: (config) => {
    // 添加别名
    config.resolve.alias
      .set("@", resolve("src"))
      .set("@/assets", resolve("src/assets"))
      .set("@/plugins", resolve("src/plugins"))
      .set("@/components", resolve("src/components"))
      .set("@/views", resolve("src/views"))
      .set("@/services", resolve("src/services"))
      .set("@/utils", resolve("src/utils"))
      .set("@/mock", resolve("src/mock"));
    config.optimization.minimizer("terser").tap((args) => {
      // 去除生产环境console
      args[0].terserOptions.compress.drop_console = true;
      return args;
    });
  },
  devServer: {
    port: 4002,
  },
});
